home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacUser ROM 45
/
MACUSER-ROM-VOL-45-1997-08.ISO.7z
/
MACUSER-ROM-VOL-45-1997-08.ISO
/
本誌連動
/
第9回:ウイークエンドデベロッパーへの道
/
QuickCinema 1.0
/
Source code
/
Initialize.c
next >
Wrap
Text File
|
1997-03-03
|
4KB
|
134 lines
/*------------------------------------------------------------------------------
* プログラム名: QuickCinema 1.0.0
* ファイル名: Initialize.c
*-----------------------------------------------------------------------------*/
#include "QuickCinema.h"
#include "ProtoType.h"
//----------------------------------------------------------------------------------//
// 定数定義 //
//----------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------//
// グローバル変数 //
//----------------------------------------------------------------------------------//
extern Boolean gQuitApplication;
extern Boolean gIsBackground;
extern SInt32 gSleepTime;
extern AEAddressDesc gSelfAddress;
//----------------------------------------------------------------------------------//
// プロトタイプ //
//----------------------------------------------------------------------------------//
static Boolean CheckEnvironment(void);
static void InitAppleEventHandlers(void);
//----------------------------------------------------------------------------------//
// 初期化ルーチン //
//----------------------------------------------------------------------------------//
void InitializeStuff(void)
{
Handle menuBar;
ProcessSerialNumber processSrlNumber;
MaxApplZone();
MoreMasters();
MoreMasters();
MoreMasters();
MoreMasters();
InitGraf(&qd.thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(0L);
FlushEvents(everyEvent, 0);
InitCursor();
if (CheckEnvironment() == false)
{
AlertUser(eInvalidEnvironment);
ExitToShell();
}
// Movie Toolboxを初期化する
EnterMovies();
gQuitApplication = false;
gIsBackground = false;
gSleepTime = kSleepTime;
processSrlNumber.highLongOfPSN = 0;
processSrlNumber.lowLongOfPSN = kCurrentProcess;
FailIfErr(AECreateDesc(typeProcessSerialNumber, (Ptr)&processSrlNumber,
sizeof(ProcessSerialNumber), &gSelfAddress));
if (!(menuBar = GetNewMBar(rMenuBarResID)))
{
AlertUser(eGoodbyeError);
ExitToShell();
}
SetMenuBar(menuBar);
DisposeHandle(menuBar);
AppendResMenu(GetMenuHandle(mApple), kDeskAccessoryType);
DrawMenuBar();
InitAppleEventHandlers();
}
//----------------------------------------------------------------------------------//
// マックの環境チェック //
//----------------------------------------------------------------------------------//
static Boolean CheckEnvironment(void)
{
SInt32 response;
OSErr err;
err = Gestalt(gestaltSystemVersion, &response);
response = (response >> 8) & 0xf;
if ((!err) && (response < 7))
return false;
// QuickTimeがインストール済みであることを確認する
// Power Macintosh環境用
#ifdef powerc
if (Gestalt(gestaltQuickTime, &response) != noErr)
return false;
err = Gestalt(gestaltQuickTimeFeatures, &response);
if ((!err) && (response & 1 << gestaltPPCQuickTimeLibPresent))
return true;
else
return false;
// 68K Macintosh環境用
#else
if (Gestalt(gestaltQuickTime, &response) != noErr)
return false;
else
return true;
#endif
}
//----------------------------------------------------------------------------------//
// イベントディスパッチテーブル登録 //
//----------------------------------------------------------------------------------//
static void InitAppleEventHandlers(void)
{
FailIfErr(AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
NewAEEventHandlerProc(HandleOpenApplication), 0L, false));
FailIfErr(AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
NewAEEventHandlerProc(HandleOpenDocument), 0L, false));
FailIfErr(AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
NewAEEventHandlerProc(HandleOpenDocument), 0L, false));
FailIfErr(AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
NewAEEventHandlerProc(HandleQuitApplication), 0L, false));
}